#ifndef PREVIEW_H
#define PREVIEW_H

#include <QtGui/QWidget>
#include <QHttp>
#include <QXmlStreamReader>
#include <QUrl>
#include <QListWidget>
#include <QDesktopServices>
#include <QTime>

namespace Ui {
    class Preview;
}

class Preview : public QWidget {
    Q_OBJECT
public:
    Preview(QWidget *parent = 0);
    ~Preview();
public slots:
    void fetch(QString Url);
    void finished(int id, bool error);
    void readData(const QHttpResponseHeader &);

protected:
    void changeEvent(QEvent *e);

private:
    Ui::Preview *m_ui;
    void parseXml();
    void itemActivated(QListWidgetItem * item);
    QXmlStreamReader xml;
    QString currentTag;
    QString linkString;
    QString titleString;
    QString desctiptionString;
    QStringList feeds;
    QHttp http;
    int connectionId;
private slots:
    void on_titlesList_itemDoubleClicked(QListWidgetItem* item);
    void on_refreshButton_clicked();
};

#endif // PREVIEW_H
